﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WuDada.Core.SystemApplications.Persistence;
using WuDada.Core.SystemApplications.Domain;
using System.Globalization;

namespace WuDada.Core.SystemApplications.Service.Impl
{
    public class CityService : ICityService
    {
        public ICityDao CityDao { get; set; }

        /// <summary>
        /// 新增縣市
        /// </summary>
        /// <param name="cityVO">被新增的縣市</param>
        /// <returns>新增後的縣市</returns>
        public CityVO CreateCity(CityVO cityVO)
        {
            return CityDao.CreateCity(cityVO);
        }

        /// <summary>
        /// 更新縣市
        /// </summary>
        /// <param name="cityVO">被更新的縣市</param>
        /// <returns>更新後的縣市</returns>
        public CityVO UpdateCity(CityVO cityVO)
        {
            return CityDao.UpdateCity(cityVO);
        }

        /// <summary>
        /// 取得縣市 By 識別碼
        /// </summary>
        /// <param name="cityId">識別碼</param>
        /// <returns>縣市</returns>
        public CityVO GetCityById(int cityId)
        {
            return CityDao.GetCityById(cityId);
        }

        /// <summary>
        /// 取得縣市清單
        /// </summary>
        /// <returns>縣市清單</returns>
        public IList<CityVO> GetCityList()
        {
            return CityDao.GetCityList();
        }

        /// <summary>
        /// 取得縣市 By 縣市名稱
        /// </summary>
        /// <param name="cityName">縣市名稱</param>
        /// <returns>縣市</returns>
        public CityVO GetCityByCityName(string cityName)
        {
            return CityDao.GetCityByCityName(cityName);
        }

        /// <summary>
        /// 新增地區
        /// </summary>
        /// <param name="areaVO">被新增的地區</param>
        /// <returns>新增後的地區</returns>
        public AreaVO CreateArea(AreaVO areaVO)
        {
            return CityDao.CreateArea(areaVO);
        }

        /// <summary>
        /// 更新地區
        /// </summary>
        /// <param name="areaVO">被更新的地區</param>
        /// <returns>更新後的地區</returns>
        public AreaVO UpdateArea(AreaVO areaVO)
        {
            return CityDao.UpdateArea(areaVO);
        }

        /// <summary>
        /// 取得地區 By 識別碼
        /// </summary>
        /// <param name="areaId">識別碼</param>
        /// <returns>地區</returns>
        public AreaVO GetAreaById(int areaId)
        {
            return CityDao.GetAreaById(areaId);
        }

        /// <summary>
        /// 取得地區清單
        /// </summary>
        /// <returns>地區清單</returns>
        public IList<AreaVO> GetAreaList()
        {
            return CityDao.GetAreaList();
        }

        /// <summary>
        /// 取得地區 By 地區名稱 And CityId
        /// </summary>
        /// <param name="areaName">地區名稱</param>
        /// <param name="cityId">CityId</param>
        /// <returns>地區</returns>
        public AreaVO GetAreaByAreaNameAndCityId(string areaName, int cityId)
        {
            return CityDao.GetAreaByAreaNameAndCityId(areaName, cityId);
        }

        /// <summary>
        /// 取得地區清單 By CityId
        /// </summary>
        /// <param name="cityId">CityId</param>
        /// <returns>地區清單</returns>
        public IList<AreaVO> GetAreaListByCityId(int cityId)
        {
            return CityDao.GetAreaListByCityId(cityId);
        }
    }
}
